from django.contrib.gis import admin
from chicago.models import *

class RepAdmin(admin.OSMGeoAdmin):
    prepopulated_fields = {'slug': ('first_name','middle_name','last_name',)}
    list_display= ('__unicode__','get_regions','get_feeds')
    search_fields  = ['first_name', 'last_name']
    list_per_page = 50


admin.site.register(Rep, RepAdmin)

#class WardAdmin(admin.OSMGeoAdmin):
#class WardAdmin(admin.OSMGeoAdmin):

# OSMGeoAdmin subclass Causes a bug because of the GeometryField i think
# should probably use a multipolygon field

    # Default GeoDjango OpenLayers map options
    #scrollable = False
    #map_width = 700
    #map_height = 325
    #list_display = ('__unicode__','ward','alderman','rep')

#admin.site.register(Ward, WardAdmin)
admin.site.register(Ward)

class HouseAdmin(admin.OSMGeoAdmin):

    # Default GeoDjango OpenLayers map options
    scrollable = False
    map_width = 700
    map_height = 325
    list_display = ('__unicode__','rep','district','telephone','address')

admin.site.register(House, HouseAdmin)

class SenateAdmin(admin.OSMGeoAdmin):
    list_display = ('__unicode__','rep','senate','telephone','address')

admin.site.register(Senate, SenateAdmin)

class CongressAdmin(admin.OSMGeoAdmin):
    list_display = ('__unicode__','uscong','rep','district','telephone','address',)
 
admin.site.register(Congress, CongressAdmin)

class FeedMapAdmin(admin.OSMGeoAdmin):
    list_display = ('__unicode__','feed')
    search_fields  = ['feed__title', 'feed__public_url'],

admin.site.register(FeedMap, FeedMapAdmin)

class SubscriptionAdmin(admin.OSMGeoAdmin):
    list_display = ('email','created','feed','remove','confirmed')
    search_fields  = ['email',]

admin.site.register(Subscription, SubscriptionAdmin)

